import { defHttp } from '/@/utils/http/axios';

enum Api {
  sql = '/rule/sql',
  set = '/rule/state/set',
  info = '/source/query/info',
  test = '/rule/test',
  datasource = '/source/query',
  save = '/rule/add',
  delete = '/rule/delete',
}

/**
 * 根据规则数据类型获取sql,可选参数
 * @param params
 */
export const sqlRequest = (params) => {
  return defHttp.get({ url: Api.sql, params });
};
/**
 * 启用/停用
 * @param params
 */
export const setRequest = (params) => {
  return defHttp.post({ url: Api.set, params });
};
/**
 * 复制/查看
 * @param params
 */
export const infoRequest = (params) => {
  return defHttp.post({ url: Api.info, params });
};
/**
 * 调试
 * @param params
 */
export const testRequest = (params) => {
  return defHttp.post({ url: Api.test, params });
};
/**
 * 数据源列表
 * @param params
 */
export const sourceRequest = (params) => {
  return defHttp.post({ url: Api.datasource, params });
};
/**
 * 删除
 * @param params
 */
export const deleteRequest = (params) => {
  return defHttp.post({ url: Api.delete, params });
};
/**
 * 保存
 * @param params
 */
export const saveOrUpdate = (params) => {
  return defHttp.post({ url: Api.save, params });
};
